CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/[owner].tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
// Route given by an account or organization name.
7
8
import getOwner from "lib/names/owner";
9
import getAccountInfo from "lib/share/get-account-info";
10
import Account from "components/account/account";
11
import withCustomize from "lib/with-customize";
12
13
export default function Owner(props) {
14
if (props.type == "account") {
15
return <Account {...props} />;
16
}
17
// TODO
18
return (
19
<div style={{ margin: "30px" }}>
20
<h1>Organization: {props.owner}</h1>
21
Organization pages are under construction and not yet available.
22
</div>
23
);
24
}
25
26
export async function getServerSideProps(context) {
27
const { owner } = context.params;
28
let info;
29
try {
30
info = await getOwner(owner);
31
} catch (_err) {
32
//console.log(_err);
33
return { notFound: true };
34
}
35
if (info.type == "account") {
36
const accountInfo = await getAccountInfo(info.owner_id, context.req);
37
return await withCustomize({ context, props: { ...info, ...accountInfo } });
38
}
39
40
return await withCustomize({ context, props: { owner, ...info } });
41
}
42
43